package observer_pattern.v2;

/**
 * 客户端主类
 * @author ricejson
 */
public class Main {
    public static void main(String[] args) {
        // 创建通知者
        Subject huhansan = new Boss("胡汉三");
        // 看股票的同事
        Observer tongshi1 = new StockObserver("魏关姹", huhansan);
        // 看NBA的同事
        NBAObserver tongshi2 = new NBAObserver("易管查", huhansan);
        huhansan.attach(tongshi1);
        huhansan.attach(tongshi2);
        huhansan.detach(tongshi1);
        // 老板回来
        huhansan.setSubjectState("我胡汉三回来啦");
        huhansan.broadcast();
    }
}
